<template>
  <div class="header">
    <!-- 折叠按钮 -->
    <div class="collapse-btn" @click="collapseChage">
      <i v-if="!collapse" class="el-icon-s-fold"></i>
      <i v-else class="el-icon-s-unfold"></i>
    </div>
    <div class="logo" id="header-title">垃圾作业监管与统计子系统</div>
    <!-- <div class="icon-wrap">
      <div
        class="icon-con"
        v-for="(item,index) in mapOperationsList"
        :class="{'hasColor': item.active}"
        :key="index"
        @click="clickInstallationShow(item, index)"
      >
        <span>{{item.name}}</span>
      </div>
    </div> -->
    <div class="header-right">
      <div class="header-user-con">
        <!-- 快捷按钮 -->
        <!-- <el-tabs class="headerTabs" type="card" v-model="activeName" @tab-click="handleClick">
          <el-tab-pane label="实时在线统计" name="first"></el-tab-pane>
        <el-tab-pane label="数据看板" name="second" @click="handleFullScreen"></el-tab-pane>-->
        <!-- <el-tab-pane label="角色管理" name="third"></el-tab-pane> -->
        <!-- <el-tab-pane label="定时任务补偿" name="fourth"></el-tab-pane> -->
        <!-- </el-tabs> -->
        <!-- 全屏显示 -->
        <!-- <div class="btn-fullscreen" @click="handleFullScreen">
                    <el-tooltip effect="dark" :content="fullscreen?`取消全屏`:`全屏`" placement="bottom">
                        <i class="el-icon-rank"></i>
                    </el-tooltip>
        </div>-->
        <!-- 消息中心 -->
        <!-- <div class="btn-bell">
                    <el-tooltip
                        effect="dark"
                        :content="message?`有${message}条未读消息`:`消息中心`"
                        placement="bottom"
                    >
                        <router-link to="/tabs">
                            <i class="el-icon-bell"></i>
                        </router-link>
                    </el-tooltip>
                    <span class="btn-bell-badge" v-if="message"></span>
        </div>-->
        <i class="el-icon-user-solid" style="margin-right:-15px;"></i>
        <span class="lab" >账号：{{ accountName }}</span>
        <span class="lab" ></span>
        <i class="el-icon-s-cooperation" style="margin-right:-15px"></i>
        <span class="lab" >项目：{{ projectName }}</span>
        <el-button type="primary" icon="el-icon-menu" @click="goSystemMenu">首页菜单</el-button>
        <div style="font-weight:bold;color:#fff;margin-left:30px; ">
          <p>技术支持</p>
          <p>联合远航</p>
        </div>
        <!-- <div style="font-weight:bold;color:#fff;margin-left:30px; ">
          <p>技术支持</p>
          <p>联通中讯</p>
        </div> -->
      </div>
    </div>
  </div>
</template>
<script>
import bus from '../common/bus';
import Astrict from '@/utils/exportExcel/astrict.js'
export default {
  data () {
    return {
      mapOperationsList: [{
        name: '实时在线统计',
        icon: 'el-icon-truck'
      }, {
        name: '数据看板',
        icon: 'el-icon-box'
      }],
      collapse: false,
      fullscreen: false,
      name: 'linxin',
      message: 2,
      accountName: localStorage.getItem('REMARK'),
      projectName: localStorage.getItem('USERNAME'),
      // roletName: localStorage.getItem('USERNAME'),
    };
  },
  computed: {
    username () {
      let username = localStorage.getItem('USERNAME');
      return username ? username : this.name;
    }
  },
  methods: {
    // 用户名下拉菜单选择事件
    handleCommand (command) {
      if (command == 'loginout') {
        localStorage.removeItem('ms_username');
        this.$router.push('/login');
      }
    },
    goSystemMenu () {
      this.$router.push({
        path: '/systemMenu'
      })
    },
    // 侧边栏折叠
    collapseChage () {
      this.collapse = !this.collapse;
      bus.$emit('collapse', this.collapse);
    },
    // 全屏事件
    handleFullScreen () {
      let element = document.documentElement;
      if (this.fullscreen) {
        if (document.exitFullscreen) {
          document.exitFullscreen();
        } else if (document.webkitCancelFullScreen) {
          document.webkitCancelFullScreen();
        } else if (document.mozCancelFullScreen) {
          document.mozCancelFullScreen();
        } else if (document.msExitFullscreen) {
          document.msExitFullscreen();
        }
      } else {
        if (element.requestFullscreen) {
          element.requestFullscreen();
        } else if (element.webkitRequestFullScreen) {
          element.webkitRequestFullScreen();
        } else if (element.mozRequestFullScreen) {
          element.mozRequestFullScreen();
        } else if (element.msRequestFullscreen) {
          // IE11
          element.msRequestFullscreen();
        }
      }
      this.fullscreen = !this.fullscreen;
    }
  },
  mounted () {
    Astrict() // 登出超时判断
    if (document.body.clientWidth < 1500) {
      this.collapseChage();
    }
    if (localStorage.getItem('CurrentService') === '001') {
      document.getElementById("header-title").innerHTML = '道路机扫作业监管与统计子系统'
    }
    if (localStorage.getItem('CurrentService') === '003') {
      document.getElementById("header-title").innerHTML = '垃圾作业监管与统计子系统'
    }
    if (localStorage.getItem('CurrentService') === '030') {
      // document.getElementById("header-title").innerHTML = '垃圾作业监管与统计子系统'.
      console.log(localStorage.getItem('CurrentServiceName'))
      switch (localStorage.getItem('CurrentServiceName')) {
        case '1':
          document.getElementById("header-title").innerHTML = '回收有害垃圾作业监管与统计子系统'
          break;
        case '2':
          document.getElementById("header-title").innerHTML = '装修垃圾作业监管与统计子系统'
          break;
        case '3':
          document.getElementById("header-title").innerHTML = '大件垃圾作业监管与统计子系统'
          break;
        default:
          document.getElementById("header-title").innerHTML = '垃圾作业监管与统计子系统'
          break;
      }
    }
    if (localStorage.getItem('CurrentService') === '002') {
      document.getElementById("header-title").innerHTML = '人工道路清扫保洁作业子系统'
    }
    if (localStorage.getItem('CurrentService') === '004') {
      document.getElementById("header-title").innerHTML = '公厕维保作业监管与统计子系统'
    }
    if (localStorage.getItem('CurrentService') === '006') {
      document.getElementById("header-title").innerHTML = '综合显示监管与统计子系统'
    }
    if (localStorage.getItem('CurrentService') === '005') {
      document.getElementById("header-title").innerHTML = '车辆运行维护车务机务全生命周期管理统计子系统'
    }
    if (localStorage.getItem('CurrentService') === '007') {
      document.getElementById("header-title").innerHTML = '账户角色管理子系统'
    }
    if (localStorage.getItem('CurrentService') === '008') {
      document.getElementById("header-title").innerHTML = '监督与考核子系统'
    }
    if (localStorage.getItem('CurrentService') === '011') {
      document.getElementById("header-title").innerHTML = '渣土收运子系统'
    }
    if (localStorage.getItem('CurrentService') === '012') {
      document.getElementById("header-title").innerHTML = '设施管理子系统'
    }
    if (localStorage.getItem('CurrentService') === '013') {
      document.getElementById("header-title").innerHTML = '监督与考核子系统'
    }
    if (localStorage.getItem('CurrentService') === '014') {
      document.getElementById("header-title").innerHTML = '应急事件子系统'
    }
    if (localStorage.getItem('CurrentService') === '015') {
      document.getElementById("header-title").innerHTML = '人文关怀子系统'
    }
    if (localStorage.getItem('CurrentService') === '018') {
      document.getElementById("header-title").innerHTML = '末端处置子系统'
    }
    if (localStorage.getItem('CurrentService') === '019') {
      document.getElementById("header-title").innerHTML = '餐厨垃圾作业监管与统计子系统'
    }
    if (localStorage.getItem('CurrentService') === '020') {
      document.getElementById("header-title").innerHTML = '垃圾分类作业监管与统计子系统'
    }
    if (localStorage.getItem('CurrentService') === '022') {
      document.getElementById("header-title").innerHTML = '垃圾转运子系统'
    }
    if (localStorage.getItem('CurrentService') === '023') {
      document.getElementById("header-title").innerHTML = '配置管理子系统'
    }
    if (localStorage.getItem('CurrentService') === '029') {
      document.getElementById("header-title").innerHTML = '上报大屏'
    }
    if (localStorage.getItem('CurrentService') === '030') {
      document.getElementById("header-title").innerHTML = '垃圾作业监管与统计子系统'
    }
  }
};
</script>
<style scoped lang="less">
// /deep/.el-tabs__item {
//   padding: 0 20px;
//   height: 40px;
//   -webkit-box-sizing: border-box;
//   box-sizing: border-box;
//   line-height: 40px;
//   display: inline-block;
//   list-style: none;
//   font-size: 15px;
//   font-weight: 500;
//   color: #fff;
//   position: relative;
// }
// /deep/.el-tabs__item.is-active {
//   border-bottom-color: #007acc; //批改激活表头字体色彩，默认是蓝色
// }
.headerTabs {
  position: relative;
  line-height: 2.865vw;
  bottom: -0.521vw;
  right: 5%;
}
.header {
  position: relative;
  box-sizing: border-box;
  width: 100%;
  height: 4.688vw;
  font-size: 1.146vw;
  color: #fff;
}
.collapse-btn {
  float: left;
  padding: 0 1.25vw;
  cursor: pointer;
  line-height: 3.646vw;
}
.header .logo {
  height: 100%;
  float: left;
  /* font-weight: bold; */
  font-size: 1.667vw;
  padding-top: 0.781vw;
  padding-left: 0.365vw;
}
.header-right {
  float: right;
  padding-right: 1.563vw;
}
.header-user-con {
  display: flex;
  height: 3.646vw;
  align-items: center;
}
.btn-fullscreen {
  transform: rotate(45deg);
  margin-right: 0.26vw;
  font-size: 1.25vw;
}
.btn-bell,
.btn-fullscreen {
  position: relative;
  width: 1.563vw;
  height: 1.563vw;
  text-align: center;
  border-radius: 0.781vw;
  cursor: pointer;
}
.btn-bell-badge {
  position: absolute;
  right: 0;
  top: -0.104vw;
  width: 0.417vw;
  height: 0.417vw;
  border-radius: 0.208vw;
  background: #f56c6c;
  color: #fff;
}
.btn-bell .el-icon-bell {
  color: #fff;
}
.user-name {
  margin-left: 0.521vw;
}
.user-avator {
  margin-left: 1.042vw;
}
.user-avator img {
  display: block;
  width: 2.083vw;
  height: 2.083vw;
  border-radius: 50%;
}
.el-dropdown-link {
  color: #fff;
  cursor: pointer;
}
.el-dropdown-menu__item {
  text-align: center;
}
.icon-con {
        width: 6.25vw;
        height: 1.823vw;
        float: left;
        border: 1px solid #fff;
        text-align: center;
        margin-left:0.521vw;
        margin-top:  0.625vw;
        padding-top: 0.625vw;
        position: relative;
        border-radius: 0.521vw;
        // i {
        //   font-size: 20px;
        //   display: block;
        //   margin-bottom: 5px;
        //   color: #333;
        // }
        // .el-tag.el-tag--mini {
        //   position: absolute;
        //   right: 0;
        //   top: -8px;
        //   height: 15px;
        //   line-height: 15px;
        //   border-color: #e1dada;
        //   background: #e1dada;
        //   color: #666;
        // }
        // span {
        //   font-size: 12px;
        //   color: #666;
        // }
        // &.hasColor {
        //   i {
        //     color: #007acc;
        //   }
        //   .el-tag.el-tag--mini {
        //     border-color: #007acc;
        //     background: #007acc;
        //     color: #fff;
        //   }
        // }
      }
.lab{
  color:#fff;
  margin-left:1.042vw;
  font-size:0.781vw;
}
</style>
